package com.gzhryc.system.dao.db;

import java.io.Serializable;
import java.util.Date;

import com.gzhryc.common.StringTools;
import com.gzhryc.common.config.DefaultEnum;
import com.gzhryc.jdbc.annotaion.Column;
import com.gzhryc.jdbc.annotaion.Id;
import com.gzhryc.jdbc.annotaion.Table;
import com.gzhryc.system.dao.enums.ManagerEnum;

/**
 * 用户信息
 * 
 * @author 张浩
 * @version 0.1.0
 */
@Table(name = "sys_manager")
public class Manager implements Serializable{

	private static final long serialVersionUID = 1L;

	@Id
	protected Long id;

	@Column
	protected String name;

	@Column(length = 16)
	protected String phone;

	@Column(name = "login_name")
	protected String loginName;

	@Column(name = "login_pwd")
	protected String loginPwd;

	@Column(note = " 登陆Token，用户API登陆验证")
	protected String token;

	@Column(length = 4, note = "管理员类型，1-普通管理员，99-超级管理员")
	protected Integer type;

	@Column(length = 4, note = "管理员状态")
	protected Integer status;

	@Column(name = "last_login_date")
	protected Date lastLoginDate;

	@Column(name = "pwd_update_date", note = "密码修改时间")
	protected Date pwdUpdateDate;

	@Column(name = "update_date", autoUpdateTime = true)
	protected Date updateDate;

	@Column(name = "create_date")
	protected Date createDate;

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getLoginPwd() {
		return loginPwd;
	}

	public void setLoginPwd(String loginPwd) {
		this.loginPwd = loginPwd;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public Date getLastLoginDate() {
		return lastLoginDate;
	}

	public void setLastLoginDate(Date lastLoginDate) {
		this.lastLoginDate = lastLoginDate;
	}

	public Date getCreateDate() {
		return createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public Date getPwdUpdateDate() {
		return pwdUpdateDate;
	}

	public void setPwdUpdateDate(Date pwdUpdateDate) {
		this.pwdUpdateDate = pwdUpdateDate;
	}

	public Date getUpdateDate() {
		return updateDate;
	}

	public void setUpdateDate(Date updateDate) {
		this.updateDate = updateDate;
	}

	public String getStatusName() {
		return DefaultEnum.Status.note(this.status);
	}

	public String getTypeName() {
		return ManagerEnum.Type.note(this.type);
	}

	public String getFullName(){
		String name = this.name;
		if(StringTools.isBlank(name)){
			name = this.loginName;
		}
		if(StringTools.isNotBlank(this.phone)){
			name = name + "("+this.phone+")";
		}
		return name;
	}
}
